home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl5
-
- # Apps.hinv.cgi
- # Silicon Graphics
-
- &generic;
-
- sub generic {
- print "Content-type: text/html\n\n";
-
- print "<html><head><title>Hardware Inventory</title>\n";
-
- print "<body bgcolor=\'decec4\' background=/apps/hinv.bg.gif>\n";
-
- open(IN, "/usr/OnRamp/bin/htnetwork |");
- $my_name = <IN>;
- $my_name = (split(/:/,$my_name))[5];
- chop($my_name);
- close(IN);
-
- $str = "Hardware inventory for <br>" .
- "<font size=7><tt>$my_name</tt></font>";
- print "<table width=100%>",
- "<tr><th align=left><h2>$str</h2></th>\n",
- "<th align=right><a href=\"/newsplash.shtml\">",
- "<img height=55 width=57 border=0 src=/apps/home.gif></a>\n",
- " <a href=\"Apps.shtml\">",
- "<img height=55 width=57 border=0 src=/apps/back.gif></a>",
- "</tr></table>\n";
-
- print "<br><hr width=50% size=6><br>";
-
- print "<center>\n";
-
- print "<table width=600>\n";
-
- open(IN,"/sbin/hinv |");
-
- while(<IN>) {
-
- ($a,$b,$c) = split(/:/);
-
- $b .= $c;
- if ($a ne " Disk drive") {
- print "<tr valign=top><th align=right nowrap>$a<td> "
- . "</td><td><tt>$b</tt></td></tr>\n";
- }
-
- }
-
- close(IN);
-
- print "</table><p><hr width=50% size=6>";
-
- print "</center><h3>Disk drives:</h3><center>";
-
- print "<table width=600>";
-
- open(IN,"/usr/sbin/df |");
-
- $first = <IN>;
- # @names = split(/\s+/, $first);
-
- @names = ('Filesystem','Size (MB)','Used (MB)','Mounted on');
-
- print "<tr>\n";
- foreach (@names) { print "<th align=left>$_\n"; }
- print "</tr>\n";
-
- while(<IN>) {
-
- ($fs,$dum,$bl,$us,$av,$pct,$where) = split(/\s+/);
-
- # df info is in 512-byte blocks
- $bl /= 2048; $bl =~ s/(\d*\.\d).*/$1/g;
- $us /= 2048; $us =~ s/(\d*\.\d).*/$1/g;
-
- print "<tr>\n";
- print "<td><tt>$fs</tt></td><td><tt>$bl</tt></td>\n";
- print "<td><tt>$us</tt></td><td><tt>$where</tt></td>";
- print "</tr>\n";
- }
-
- close(IN);
-
- print "</table></center></body></html>\n";
- }
-